package JavaSE.CODE.javaIO;

import java.io.BufferedInputStream;
import java.io.FileInputStream;

public class BufferedInputStreamDemo {
    public static void main(String[] args) throws Exception {
        //1、创建Input类，注意BufferedInputStream需要FileIS作为参数
        FileInputStream fileInputStream = new FileInputStream("d:\\fileInput.txt");
        BufferedInputStream bis = new BufferedInputStream(fileInputStream);

        //2、读取
        /*
        int data = 0;
        while((data=bis.read())!=-1){
            System.out.print((char) data);
        }
        */

        byte[] buf = new byte[1024];
        int count = 0;
        while((count=bis.read(buf))!=-1){
            System.out.println(new String(buf, 0, count));
        }

        //3、关闭bis，内部就关闭了FileIS
        bis.close();





    }



}
